/*	
 *				
 *					ISNW ---- It is a war.It is not warcraft!
 *
 *
 *					Author:					zhoukeli(haxixi_keli)
 *					Filename:				MeshSceneNode.h
 *					CreateTime:				2008/12/29
 *					ModifyTime:				2008/12/29
 *
 */

#ifndef __MESH_SCENE_NODE_H__
#define __MESH_SCENE_NODE_H__

#include "include/IMeshSceneNode.h"

namespace ISNW
{
namespace scene
{
	class MeshSceneNode : public IMeshSceneNode
	{
	public:
		MeshSceneNode(ISceneManager* sm,ISceneNode* parent,IMesh* m,s32 id,core::vector3df pos,core::vector3df rotate,
			core::vector3df scale):IMeshSceneNode(sm,parent,m,id,pos,rotate,scale),mesh(0)
		{
			setmesh(m);
		}

	public:
		void setmesh(IMesh* m)
		{
			if(mesh)
			{
				mesh->drop();
			}
			if(m)
			{
				m->grab();
				mesh = m;
			}
		}

		const IMesh* getmesh() const
		{
			return mesh;
		}

		void render();

		void onRegisterSceneNode();

	protected:
		IMesh*			mesh;
	};
} // end namespace scene
} // end namespace ISNW
#endif
